import { PureComponent } from 'react';
import moment from 'moment';
import {
    Row,
    Col,
    Form,
    Input,
    Select,
    Modal,
    DatePicker
} from 'antd';
const FormItem = Form.Item;
const { Option } = Select;


@Form.create()
class CreateForm extends PureComponent {
	
	constructor(props) {
	    super(props);
	    this.state = {
	    	
	    }
	}
 

	okHandle = () => {
		const { form,handleAddByLinkMan } = this.props;

	    form.validateFields((err, fieldsValue) => {
		        if (err) return;
			    form.resetFields();
			    handleAddByLinkMan(fieldsValue);
		});
	};
	
	
	resetButton = () => {

	};

  render() {
    const {form: {getFieldDecorator}, modalVisibleByLinkMan,handleModalVisibleByLinkMan} = this.props;

return (
    <Modal
width={800}
destroyOnClose
title="添加联系人"
visible={modalVisibleByLinkMan}
onOk={this.okHandle}
onCancel={() => handleModalVisibleByLinkMan()}
afterClose={() => this.resetButton()}
>
<Form  layout="vertical">
    	<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

	        <Col  md={12} sm={24}>
		        <FormItem  label="联系人姓名">
		            {getFieldDecorator('linkman_name', {
		            rules: [{ required: true, message: '请输入1-50位字符的联系人姓名', max: 50}],
		            })(<Input placeholder="1-50位字符" />)}
		        </FormItem>
	        </Col>
	        <Col  md={12} sm={24}>
		        <FormItem  label="关系">
		            {getFieldDecorator('linkman_gx', {
		            rules: [{ required: false, message: '最多输入50位字符', max: 50}],
		            })(<Input placeholder="1-50位字符" />)}
		        </FormItem>
	        </Col>
		
    	</Row>
    	<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

	        <Col md={12} sm={24}>
	          <FormItem  label="联系人电话">
	              {getFieldDecorator('linkman_phone', {
	              rules: [{ required: false, message: '手机号码格式不符！',  pattern:/^1(3|4|5|6|7|8|9)\d{9}$/ }],
	              })(<Input placeholder="正规手机号格式" />)}
	          </FormItem>
	        </Col>
	       	<Col  md={12} sm={24}>
		        <FormItem  label="联系人工作单位">
		            {getFieldDecorator('linkman_gzdw', {
		            rules: [{ required: false, message: '最多输入50位字符', max: 50}],
		            })(<Input placeholder="1-50位字符" />)}
		        </FormItem>
	        </Col>

    	</Row>
    	<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

	        <Col  md={12} sm={24}>
		        <FormItem  label="联系人职务">
		            {getFieldDecorator('linkman_zw', {
		            rules: [{ required: false, message: '最多输入50位字符', max: 50}],
		            })(<Input placeholder="1-50位字符" />)}
		        </FormItem>
	        </Col>
		
    	</Row>

</Form>
</Modal>
);
  }

}

export default CreateForm;
